#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/11/10 21:04
# @Author  : lizhen
# @Site    : 
# @File    : cString.py
# @Software: PyCharm
import re


class StringDemo:
    def _test_base(self):
        """
        sd = StringDemo()
        sd._test_base()
        """
        line = 'asdf fjdk; afed, fjek,asdf, foo'  # re.split
        print(re.split(r'[;,\s]\s*', line))
        print(re.split(r'(;|,|\s)\s*', line))
        print(re.split(r'(?:,|;|\s)\s*', line))

        filename = 'spam.txt'  # re.startswith, re.endswith
        print(filename.endswith('.txt'))
        print(filename.startswith('file:'))


if __name__ == '__main__':
    sd = StringDemo()
    sd._test_base()
